Returns an array of FQDNs of locked (user and/or, computer accounts), lockout time and minutes remaining in locked state.
#Include <AD.au3>
_AD_GetObjectsLocked([$sClass = "user"[, $sRoot = ""]])
Parameters
| $sClass | Optional: Specifies if locked user accounts or computer accounts should be returned (default = "user"). "user" - Returns objects of category "user" "computer" - Returns objects of category "computer" |
| $sRoot | Optional: FQDN of the OU where the search should start (default = "" = search the whole tree) |
Return Value
Success: Returns a one-based two dimensional array with the following information:
Remarks
LockoutTime contains the timestamp when the object was locked. This value is not reset until the user/computer logs on again.
Related
_AD_IsObjectLocked, _AD_UnlockObject
See Also
http://technet.microsoft.com/en-us/library/cc780271%28WS.10%29.aspx
Example
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <AD.au3>
; Open Connection to the Active Directory
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
Global $aLocked[1][2]
; *****************************************************************************
; Example 1
; Get a list of locked accounts
; *****************************************************************************
$aLocked = _AD_GetObjectsLocked()
If @error > 0 Then
MsgBox(64, "Active Directory Functions - Example 1", "No locked user accounts have been found. Error: " & @error)
Else
_ArrayDisplay($aLocked, "Active Directory Functions - Example 1 - Locked User Accounts")
EndIf
; *****************************************************************************
; Example 2
; Get a list of locked computers
; *****************************************************************************
$aLocked = _AD_GetObjectsLocked("computer")
If @error > 0 Then
MsgBox(64, "Active Directory Functions - Example 2", "No locked computers have been found")
Else
_ArrayDisplay($aLocked, "Active Directory Functions - Example 2 - Locked Computers")
EndIf
; Close Connection to the Active Directory
_AD_Close()